/**
 * @dirctive model-text
 * 用来双向绑定可编辑元素的视图模型
 */
export default {
    twoWay: true,
    bind: function() {
        this.handler = function() {
            this.set(this.el.innerHTML);
        }.bind(this)
        this.el.addEventListener('input', this.handler)
    },
    update: function(newValue, oldValue){
        this.el.innerHTML = newValue || '';
    },
    unbind: function() {
        this.el.removeEventListener('input', this.handler)
    }
}
